package com.nwpu.bigdata.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.nwpu.bigdata.dto.Common;
import com.nwpu.bigdata.service.MemoryService;



/**
 *@version:2018年6月11日下午4:36:34
*/
/**
 * @author Administrator
 *
 */
@Controller
@RequestMapping("/memory")
public class MemoryController {
@Autowired
private MemoryService memoryService;
	@RequestMapping(value="/node/utilization", method={RequestMethod.GET}, produces="application/json;charset=UTF-8")
	public @ResponseBody List<Common> memoryNode(ModelAndView modelAndView) throws Exception {

		List<Common> list = memoryService.MemoryNodeMetrics();
	
		return list;
	}
	@RequestMapping(value="/neo4j/usage", method={RequestMethod.GET}, produces="application/json;charset=UTF-8")
	
	public @ResponseBody List<Common> neo4jMeomory(ModelAndView modelAndView) throws Exception {


		List<Common> list = memoryService.softwareMemoryMetrics("ingraphdb");
		
		return list;
	}
	 @RequestMapping(value="/cassandra/usage", method={RequestMethod.GET}, produces="application/json;charset=UTF-8")
		
		public @ResponseBody List<Common> cassandraMemory(ModelAndView modelAndView) throws Exception {

			List<Common> list = memoryService.softwareMemoryMetrics("kvstore");
			
			return list;
   }
	 @RequestMapping(value="/iotdb/usage",  method={RequestMethod.GET}, produces="application/json;charset=UTF-8")
		
		public @ResponseBody List<Common> iotdbMemory(ModelAndView modelAndView) throws Exception {


			List<Common> list = memoryService.softwareMemoryMetrics("iotdb");
			
			return list;
   }
	 @RequestMapping(value="/mysql/usage", method={RequestMethod.GET}, produces="application/json;charset=UTF-8")
		
		public @ResponseBody List<Common> mysqlMemory(ModelAndView modelAndView) throws Exception {

			List<Common> list = memoryService.softwareMemoryMetrics("kingbase");
			
			return list;
   }
	 @RequestMapping(value="/nosqldb/usage", method={RequestMethod.GET}, produces="application/json;charset=UTF-8")
		
		public @ResponseBody List<Common> unstructuredMemory(ModelAndView modelAndView) throws Exception {


			List<Common> list = memoryService.softwareMemoryMetrics("unstructfs");
			
			return list;
		}
}
